/**
 * Created by baiguiren on 2/10/17.
 */

//session
let redis = require('redis');
let session = require('express-session');
let redisStore = require('connect-redis')(session);
let client =redis.createClient();
let config = require('../config');

let sess = session({
  secret: 'node_shells',
  cookie: { maxAge: 2628000000 },
  store: new redisStore({
    host: 'localhost',
    port: 6379,
    prefix: config.redis.prefix,
    client: client,
    //ttl: 260 //session 260秒过期
    disableTTL: true, //session设置永不过期
  }),
  saveUninitialized: false,
  resave: false
});

exports = module.exports = sess;